package ttu.idu0080.orderShipmentService_client;

/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.xml.namespace.QName;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.ws.Action;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF 2.5.2 2012-05-15T01:09:58.977+03:00
 * Generated source version: 2.5.2
 * 
 */
public final class OrderShipmentService_OrderShipmentServicePort_Client {

	private static final QName SERVICE_NAME = new QName(
			"http://server.order.idu0080.ttu/", "OrderShipmentServiceService");

	public OrderShipmentService_OrderShipmentServicePort_Client() {
	}

	public void insertOrderShipment(int order_id, String ryhm_name,
			String tracking_nr, String courier_name, int approx_delivery_date,
			double shipping_price) throws java.lang.Exception {
		URL wsdlURL = OrderShipmentServiceService.WSDL_LOCATION;
		String[] args = { "" };
		Calendar calendar = Calendar.getInstance();
		SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
		calendar.add(Calendar.DATE, approx_delivery_date);
		String date = dateFormat.format(calendar.getTime());
		Date d = dateFormat.parse(date);

		GregorianCalendar g = new GregorianCalendar();
		g.setTime(d);
		XMLGregorianCalendar date2 = DatatypeFactory.newInstance()
				.newXMLGregorianCalendar(g);

		if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
			File wsdlFile = new File(args[0]);
			try {
				if (wsdlFile.exists()) {
					wsdlURL = wsdlFile.toURI().toURL();
				} else {
					// wsdlURL = new URL(args[0]);
				}
			} catch (MalformedURLException e) {
				e.printStackTrace();
			}
		}

		OrderShipmentServiceService ss = new OrderShipmentServiceService(
				wsdlURL, SERVICE_NAME);
		OrderShipmentService port = ss.getOrderShipmentServicePort();

		{
			System.out.println("Invoking insertOrderShipment...");
			port.insertOrderShipment(order_id, ryhm_name, tracking_nr,
					courier_name, date2, shipping_price);
			System.out.println("Sisestus oli edukas");
		}

	}

}
